package com.ss.android.article.browser.main;

import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.BitmapFactory;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.util.SparseArrayCompat;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewPropertyAnimator;
import android.view.ViewStub;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AnimationUtils;
import android.webkit.URLUtil;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.a.a.b;
import com.a.a.s;
import com.a.a.t;
import com.bytedance.common.utility.UIUtils;
import com.bytedance.common.utility.c.SharedPreferenceCompat;
import com.bytedance.common.utility.collection.WeakHandler;
import com.bytedance.frameworks.baselib.network.http.util.TaskInfo;
import com.ss.android.account.Spipe;
import com.ss.android.account.b.OnAccountRefreshListener;
import com.ss.android.account.v2.view.AccountLoginActivity;
import com.ss.android.article.base.app.AppData;
import com.ss.android.article.base.app.BizApplication;
import com.ss.android.article.base.app.MainActivityDelegate;
import com.ss.android.article.base.app.r;
import com.ss.android.article.base.feature.category.a.CategoryManager;
import com.ss.android.article.base.feature.category.activity.CategoryTabStrip;
import com.ss.android.article.base.feature.feed.FeedTab;
import com.ss.android.article.base.feature.feed.presenter.WebArticlePreloadHelper;
import com.ss.android.article.base.feature.main.FeedShowDetector;
import com.ss.android.article.base.feature.main.FragmentManagerWrapper;
import com.ss.android.article.base.feature.main.IFeedManager;
import com.ss.android.article.base.feature.main.IRecentFragment;
import com.ss.android.article.base.feature.main.MainHelper;
import com.ss.android.article.base.feature.model.CategoryItem;
import com.ss.android.article.base.feature.splash.BaseSplashActivity;
import com.ss.android.article.base.feature.splash.SplashAdActivity;
import com.ss.android.article.base.feature.subscribe.b.SubscribeManager;
import com.ss.android.article.base.feature.video.IVideoController;
import com.ss.android.article.base.feature.video.IVideoControllerContext;
import com.ss.android.article.base.feature.video.IVideoFullscreen;
import com.ss.android.article.base.ui.Tab;
import com.ss.android.article.base.ui.TagView;
import com.ss.android.article.base.utils.searchtext.SearchTextData;
import com.ss.android.article.base.utils.searchtext.SearchTextHelper;
import com.ss.android.article.browser.BrowserPage;
import com.ss.android.article.browser.BrowserShareHelper;
import com.ss.android.article.browser.FeedFragment;
import com.ss.android.article.browser.R;
import com.ss.android.article.browser.database.BrowserHistory;
import com.ss.android.article.browser.download.DownloadTaskManager;
import com.ss.android.article.browser.download.internal.DownloadTask;
import com.ss.android.article.browser.view.a.WebSiteGridView;
import com.ss.android.article.common.e.VideoControllerSupplierProxy;
import com.ss.android.article.common.view.SSTabHost.OnLayoutChangeListener;
import com.ss.android.article.share.entity.ShareAction;
import com.ss.android.article.share.entity.ShareImageBean;
import com.ss.android.browser.base.wrapper.a.BrowserSharedPreferencesWrapper;
import com.ss.android.common.app.AbsActivity;
import com.ss.android.common.app.AbsApplication;
import com.ss.android.common.app.WebViewTweaker;
import com.ss.android.common.lib.MobClickCombiner;
import com.ss.android.common.location.LocationUploadHelper;
import com.ss.android.common.util.ImmersedStatusBarHelper;
import com.ss.android.common.util.NetworkStatusMonitor;
import com.ss.android.common.util.NetworkUtils;
import com.ss.android.g.a;
import com.ss.android.image.AsyncImageView;
import com.ss.android.image.loader.LargeImageLoader;
import com.ss.android.j.ClickableBackgroundCompat;
import com.ss.android.messagebus.Subscriber;
import com.ss.android.messagebus.SubscriptionRouter;
import com.ss.android.newmedia.MediaAppUtil;
import com.ss.android.newmedia.a.DialogListener;
import com.ss.android.newmedia.a.InputMethodManagerUtil;
import com.ss.android.newmedia.a.OnPageScrolledListener;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public abstract class ArticleMainActivity extends AbsActivity implements
        WeakHandler.Callback,
        OnAccountRefreshListener,
        FeedTab,
        FeedShowDetector.FeedShowDetector2,
        IFeedManager,
        IVideoControllerContext,
        SearchTextHelper.OnSearchTextRefreshListener,
        BrowserPage,
        TabInspector.OnTabNumberChangedListener,
        OnLayoutChangeListener {
    public static final String CATEGORY_STRING = "CATEGORY_STRING";
    public static final String FLOAT_BUTTON_SP = "FLOAT_BUTTON";
    public static final String FLOAT_POS_X = "FLOAT_POS_X";
    public static final String FLOAT_POS_Y = "FLOAT_POS_Y";
    protected static final int TAB_COUNT = 3;
    protected static final int TAB_POS_MINE = 2;
    protected static final int TAB_POS_STREAM = 0;
    protected static final int TAB_POS_TOPIC = 2;
    protected static final int TAB_POS_VIDEO = 1;
    protected static final String TAB_STREAM = "tab_stream";
    static final String TAG = "ArticleMainActivity";
    private static final int INTENT_CODE_USER_ACTION = 10;
    private static final String KEY_IS_TAB_ENABLE_REFRESH = "isTabEnableFloatRefresh";
    private static final String KEY_TAB_ENABLE_SEND_BTN = "tab_enable_send_btn";
    private static final int LEVEL_BACK_ENABLE = 1;
    private static final int LEVEL_BACk_DISABLE = 0;
    private static final int LEVEL_FORWARD_DISABLE = 0;
    private static final int LEVEL_FORWARD_ENABLE = 1;
    private static final int LEVEL_FORWARD_REFRESH = 2;
    private static final int MSG_CHECK_CATEGORY_ALL_TIPS = 16;
    private static final int MSG_CHECK_CATEGORY_TAB_STRIP = 15;
    private static final int MSG_CLOSE_DISLIKE_TIP = 11;
    private static final int MSG_ON_FIRST_FRAME_DRAW = 14;
    private static final int MSG_ON_PULL_REFRESH = 12;
    private static final int MSG_TRY_SUBSCRIBE_BADGE = 13;
    private static final int STATUS_DIM = 1;
    private static final int STATUS_SHOW = 0;
    private static final int STREAM_TAB_MODE_OLD = 0;
    private static final int STREAM_TAB_MODE_REFRESH = 1;
    private static final int STREAM_TAB_MODE_STREAM = 2;
    private static final int SWITCH_REASON_CLICK = 2;
    private static final int SWITCH_REASON_FLIP = 1;
    private static final long TAB_STAY_LOG_INTERVAL = 3000;
    private static final String TAG_GO_BACK = "go_back";
    private static final String TAG_GO_NEXT = "go_next";
    private static final String TAG_HOME = "home";
    private static final String TAG_MENU = "menu";
    private static final String TAG_MULTI_WINDOWS = "multi_windows";
    private static final float THRESHOLD_HEIGHT = 0f;
    final Handler mHandler;
    final List<CategoryItem> mList;
    public boolean hasUpdateAddFloatBtn;
    public int mEdgePadding;
    public ImageView mFloatBtn;
    public WindowManager.LayoutParams mFloatBtnWindowParams;
    public View mFloatBtnWrapper;
    public Rect mFloatViewBoundsInScreen;
    public WindowManager mWindowManager;
    protected boolean isFullScreen;
    protected AppData mAppData;
    protected View mContentLayout;
    protected IVideoController mVideoController;
    protected IVideoFullscreen mVideoFullscreen;
    protected LargeImageLoader mLargeImageLoader;
    protected MainHelper mMainHelper;
    protected ViewStub mNewHeadLayoutStub;
    protected View mSearchLayout;
    protected Spipe mSpipe;
    protected TaskInfo mTaskInfo;
    protected View mTopCategoryBar;
    protected CategoryTabStrip mTopCategoryStrip;
    protected int mUseTabTip;
    protected BrowserShareHelper mBrowserShareHelper;
    protected FeedFragment mFeedFragment;
    protected Dialog mMenuDialog;
    protected WebSiteGridView mWebsiteGridView;
    protected View mTabContainer;
    protected FrameLayout mVideoHolder;
    protected boolean mForwardRefresh;
    protected int redCount;
    CategoryManager mCategoryMgr;
    WeakReference mDislikeDlgRef;
    boolean mFirstFrameDrawn;
    boolean mIsNightMode;
    ViewGroup mMainLayout;
    View mMineView;
    NetworkStatusMonitor mNetworkMonitor;
    View mSearchView;
    boolean mSkipForceStream;
    View mStatusBarTintView;
    ViewStub mVideoHolderStub;
    private boolean isWindowFocus;
    private int mActivityCount;
    private Intent mCategoryIntent;
    private int mCurTheme;
    private View mCurrentView;
    private List<DelayInitCallback> mDelayInitCallbacks;
    private DialogListener mDlgListener;
    private FeedShowDetector mFeedShowDetector;
    private int[] mFirstVisibleItemArray;
    private boolean mForceNotShowAdWhenResume;
    private FragmentManager mFragmentManager;
    private boolean mHasDelayInit;
    private String mHomeSearchSuggestText;
    private MainActivityDelegate mIMainActivityDelegate;
    private boolean mIsFirstResume;
    private int mIsRefreshBottomButtonAnimateStatus;
    private ViewPropertyAnimator mIsRefreshBottomButtonAnimation;
    private CategoryItem mLastAddCategoryItem;
    private int mLastStreamMode;
    private float mLastY;
    private boolean mLaunchEnterFirstTab;
    private boolean mLaunchEnterHome;
    private TextView mMainSearchHintTextView;
    private ViewStub mMainSearchLayoutStub;
    private int mMineNotificationCount;
    private boolean mOpenCategory;
    private boolean mOpenUpdate;
    private int mOriginTheme;
    private BrowserPresenter mPresenter;
    private boolean mPromptUploadContacts;
    private View mRootView;
    private View mSearchMineView;
    private String mShortCutLauncherTab;
    private float mStartY;
    private long mTabStayTime;
    private int mUpdateCount;
    private MenuItem menuSearch;
    private MenuItem menuSetting;
    private Tab[] tabs;

    public ArticleMainActivity() {
        this.mHandler = new WeakHandler(this);
        this.mList = new ArrayList();
        this.mUseTabTip = -1;
        this.mIsNightMode = false;
        this.mSkipForceStream = false;
        this.mShortCutLauncherTab = null;
        this.mIsFirstResume = true;
        this.mLaunchEnterFirstTab = false;
        this.mLaunchEnterHome = false;
        this.mFirstVisibleItemArray = new int[7];
        this.mActivityCount = 0;
        this.mMineNotificationCount = 0;
        this.mUpdateCount = 0;
        this.isWindowFocus = false;
        this.mIsRefreshBottomButtonAnimateStatus = 0;
        this.mOpenUpdate = false;
        this.mOpenCategory = false;
        this.mCategoryIntent = null;
        this.mForceNotShowAdWhenResume = false;
        this.tabs = new Tab[4];
        this.mOriginTheme = -1;
        this.mCurTheme = -1;
        this.mTabStayTime = 0;
        this.mStartY = 0f;
        this.mLastY = 0f;
        this.mDelayInitCallbacks = new LinkedList();
        this.mLastStreamMode = 2;
        this.mForwardRefresh = false;
        this.mHomeSearchSuggestText = "";
    }

    private static void removeViewFromParent(@Nullable View view) {
        if (view != null) {
            ViewParent parent = view.getParent();
            if ((parent instanceof ViewGroup)) {
                ((ViewGroup) parent).removeView(view);
            }
        }
    }

    protected void addBookMark() {
        String v1;
        String v0 = null;
        if (this.mFeedFragment != null) {
            v1 = this.mFeedFragment.getUrl();
            v0 = this.mFeedFragment.q();
        } else {
            v1 = v0;
        }

        if (android.support.design.a.isTextEmpty(v1)) {
            Toast.makeText(this, this.getString(com.ss.android.article.browser.R.string.favorite_url_can_not_be_empty), Toast.LENGTH_SHORT).show();
        } else {
            s v0_1 = s.a(
                    new com.ss.android.article.browser.database.bookmark.h(
                            com.ss.android.article.browser.database.bookmark.a.a(),
                            new BrowserHistory(v1, v0)));
            v0_1.b = android.support.design.a.c();
            v0_1.c = android.support.design.a.b();
            v0_1.a(new t() {

                public final void a(@Nullable Object arg4) {
                    super.a(arg4);
                    String v0 = ((Boolean) arg4).booleanValue()
                            ? ArticleMainActivity.this.getString(com.ss.android.article.browser.R.string.add_bookmark_success)
                            : ArticleMainActivity.this.getString(com.ss.android.article.browser.R.string.add_bookmark_fail_existed);
                    Toast.makeText(ArticleMainActivity.this, ((CharSequence) v0), Toast.LENGTH_SHORT).show();
                }
            });
        }
    }

    public void addDelayInitCallback(DelayInitCallback delayInitCallback) {
        this.mDelayInitCallbacks.add(delayInitCallback);
    }

    public void addIRecentFragment(IRecentFragment recentFragment) {
        if (this.mIMainActivityDelegate != null) {
            this.mIMainActivityDelegate.addIRecentFragment(recentFragment);
        }
    }

    private void afterFeedShowOnPaused() {
        AppData.getInstance().f(this);
    }

    private void afterFeedShowOnResumed() {
        if ((VideoControllerSupplierProxy.getInstance().getVideoControllerInstance() == null || VideoControllerSupplierProxy.getInstance().getVideoControllerInstance().getContext() != this) && (!this.mIsFirstResume && (this.mFirstFrameDrawn))) {
            this.initVideoHolder();
        }

        AppData.getInstance().b(this);
        this.mCategoryMgr.a();
        if (this.mFeedFragment != null) {
            this.mFeedFragment.b();
        }

        SubscribeManager.getInstance().c();
        this.mHandler.sendEmptyMessageDelayed(13, SubscribeManager.e());
    }

    public boolean backWebsiteNavigationControl() {
        return this.mWebsiteGridView != null && this.mWebsiteGridView.c();
    }

    public boolean canShowNotify() {
        return this.mIMainActivityDelegate != null && this.mIMainActivityDelegate.canShowNotify();
    }

    protected void delayInit() {
        if (!this.mHasDelayInit && !this.isFinishing() && !this.isDestroyed()) {
            Iterator<DelayInitCallback> iterator = this.mDelayInitCallbacks.iterator();
            while (iterator.hasNext()) {
                DelayInitCallback delayInitCallback = iterator.next();
                BaseSplashActivity.a(delayInitCallback.activity);
                ((FeedTab) delayInitCallback.activity).removeDelayInitCallback(delayInitCallback);
            }

            com.ss.android.l.c.c();
            int v0_1 = this.mAppData.getAppSettings().getRequestMobileDelay();
            if (v0_1 > 0) {
                this.mHandler.postDelayed(new com.ss.android.article.base.feature.user.account.a(), (((long) v0_1)) * 1000);
            }

            if (this.mAppData.getAppSettings().getUploadContactControl() > this.mAppData.mUploadContactVersion) {
                this.mRootView.post(new Runnable() {

                    public final void run() {
                        ArticleMainActivity.this.tryShowUploadContactsGuide();
                    }
                });
            }

            this.mHasDelayInit = true;
            if (this.mNetworkMonitor.isNetworkOn()) {
                MediaAppUtil.a();
            }

            this.mMainHelper = new MainHelper(this);
            this.mMainHelper.b();
            SubscribeManager.init(((Context) this));
            AppData.getInstance();
            if (this.mStatusActive) {
                this.afterFeedShowOnResumed();
            }

            if (!NetworkUtils.isWifi(((Context) this))) {
                return;
            }

            if (com.ss.android.article.browser.download.b.a.a(BrowserSharedPreferencesWrapper.getString("down_tmp_apk", ""))) {
                return;
            }

            if (AbsApplication.getApplication().getExternalCacheDir() == null) {
                return;
            }

            try {
                DownloadTaskManager v6 = DownloadTaskManager.getInstance();
                String apkUrl = "http://lf6-ttcdn-tos.pstatp.com/obj/rocketpackagebackup/bugfix_online/1518024128NewsArticle_browser_t_v6.5.9_b52a07b.apk";
                String tempFileName = "browser_tmp.apk";
                String saveDir = AbsApplication.getApplication().getExternalCacheDir().getAbsolutePath();
                if (!URLUtil.isNetworkUrl(apkUrl)) {
                    return;
                }

                DownloadTask downloadTask = new DownloadTask(apkUrl, saveDir, tempFileName, tempFileName, null);
                downloadTask.createTime = System.currentTimeMillis();
                v6.a(downloadTask, false);
            } catch (Exception v0_2) {
                v0_2.printStackTrace();
            }
        }
    }

    public boolean doBackPressRefresh() {
        boolean v0 = this.mIMainActivityDelegate != null ? this.mIMainActivityDelegate.doBackPressRefresh() : false;
        return v0;
    }

    public Activity getActivity() {
        return this;
    }

    public String getCategory() {
        return this.mIMainActivityDelegate != null ? this.mIMainActivityDelegate.getCategory() : "__all__";
    }

    public Fragment getCurrentFragment() {
        if (this.mIMainActivityDelegate != null) {
            this.mIMainActivityDelegate.getCurrentFragment();
        }
        return null;
    }

    public void getCurrentList(int arg2, List result) {
        if (this.mIMainActivityDelegate != null) {
            this.mIMainActivityDelegate.getCurrentList(arg2, result);
        }
    }

    public Fragment getCurrentTabFragment() {
        return null;
    }

    public int getFirstVisiblePosition() {
        return this.mIMainActivityDelegate != null ? this.mIMainActivityDelegate.getFirstVisiblePosition() : 0;
    }

    public Fragment getFollowTabFragment() {
        return null;
    }

    public ImmersedStatusBarHelper.ImmersedStatusBarConfig getImmersedStatusBarConfig() {
        int statusBarColor = this.getStatusBarColor();
        ImmersedStatusBarHelper.ImmersedStatusBarConfig immersedStatusBarConfig = new ImmersedStatusBarHelper.ImmersedStatusBarConfig();
        immersedStatusBarConfig.mFitsSystemWindows = false;
        immersedStatusBarConfig.c = true;
        immersedStatusBarConfig.mStatusBarColor = statusBarColor;
        return immersedStatusBarConfig;
    }

    public int getOriginTheme() {
        return this.mOriginTheme;
    }

    public WebArticlePreloadHelper getPreloadHelper() {
        WebArticlePreloadHelper webArticlePreloadHelper = this.mIMainActivityDelegate != null ? this.mIMainActivityDelegate.getPreloadHelper() : null;
        return webArticlePreloadHelper;
    }

    public BrowserPresenter getPresenter() {
        return this.mPresenter;
    }

    protected int getStatusBarColor() {
        if (this.isUseMainCategoryTheme()) {
            return this.getResources().getColor(com.ss.android.article.browser.R.color.status_bar_color_red);
        } else {
            r.a();
            return r.c();
        }
    }

    protected int getTabBarColor() {
        return this.isUseMainCategoryTheme() ? this.getResources().getColor(R.color.j) : this.getResources().getColor(R.color.w5);
    }

    public boolean getUseTabTip() {
        if (this.mIMainActivityDelegate != null) {
            this.mIMainActivityDelegate.getUseTabTip();
        }
        return false;
    }

    public IVideoController getVideoController() {
        return this.mVideoController;
    }

    public void handleCategoryTip(String category, String tip, String count) {
        if (this.mIMainActivityDelegate != null) {
            this.mIMainActivityDelegate.handleCategoryTip(category, tip, count);
        }
    }

    public void handleMsg(Message message) {
        if (this.isViewValid()) {
            switch (message.what) {
                case 13: {
                    if (this.isActive()) {
                        SubscribeManager.getInstance().c();
                        this.mHandler.sendEmptyMessageDelayed(13, SubscribeManager.e());
                        return;
                    }
                }
                case 14: {
                    this.onFirstFrameDraw();
                    return;
                }
            }
        }
    }

    public void hideRedPoint() {
        this.setRedPoint(false, this.redCount + "");
    }

    private void init() {
        this.getWindow().getDecorView().getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
            @Override
            public boolean onPreDraw() {
                getActivity().getWindow().getDecorView().getViewTreeObserver().removeOnPreDrawListener(this);
                mFirstFrameDrawn = true;
                return true;
            }
        });
    }

    private void initBrowser() {
        this.mPresenter = new BrowserPresenter(this);
        com.a.a.a v1 = TabInspector.a(mPresenter.mBrowserPage, this.getIntent());
        v1.b = android.support.design.a.b();
        v1.a(new b() {

            public final void a() {
                mPresenter.mBrowserPage.notifyTabViewInitialized();
                mPresenter.mBrowserPage.updateTabNumber(mPresenter.mTabInspector.tabSize());
                mPresenter.tabChanged(mPresenter.mTabInspector.e());
            }
        });
        mPresenter.mTabInspector = TabInspector.getInstance();
        this.mBrowserShareHelper = new BrowserShareHelper(this);
    }

    private void initDialogClick(View view) {
        if (view != null) {
            view.findViewById(com.ss.android.article.browser.R.id.aa9).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mMenuDialog != null) {
                        mMenuDialog.dismiss();
                    }
                    onBookMarkViewClick();
                    new com.ss.android.g.a.a$a("click_bookmark").a().a();
                }
            });
            view.findViewById(com.ss.android.article.browser.R.id.aab).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mMenuDialog != null) {
                        mMenuDialog.dismiss();
                    }

                    addBookMark();
                    new com.ss.android.g.a.a$a("click_add_bookmark").a().a();
                }
            });
            view.findViewById(com.ss.android.article.browser.R.id.aa_).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mMenuDialog != null) {
                        mMenuDialog.dismiss();
                    }

                    onHistoryPageClick();
                    new com.ss.android.g.a.a$a("click_history").a().a();
                }
            });
            view.findViewById(com.ss.android.article.browser.R.id.aac).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mMenuDialog != null) {
                        mMenuDialog.dismiss();
                    }

                    new com.ss.android.g.a.a$a("click_download").a().a();
                    onDownloadClick();
                }
            });
            view.findViewById(com.ss.android.article.browser.R.id.aaa).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    String v1;
                    String v0 = null;
                    if (mMenuDialog != null) {
                        mMenuDialog.dismiss();
                    }

                    if (mFeedFragment != null) {
                        v1 = mFeedFragment.getUrl();
                        v0 = mFeedFragment.q();
                    } else {
                        v1 = v0;
                    }

                    if ((android.support.design.a.isTextEmpty(v0)) || (TextUtils.equals("未标题的", ((CharSequence) v0)))) {
                        mBrowserShareHelper.c = mBrowserShareHelper.mActivity.getString(com.ss.android.article.browser.R.string.gn);
                        v0 = mBrowserShareHelper.mActivity.getString(com.ss.android.article.browser.R.string.go);
                    } else {
                        mBrowserShareHelper.c = v0;
                        v0 = mBrowserShareHelper.mActivity.getString(com.ss.android.article.browser.R.string.gp);
                    }

                    if (android.support.design.a.isTextEmpty(v1)) {
                        v1 = "http://www.alpha-browser.com/";
                    }

                    mBrowserShareHelper.b = v1;
                    new com.ss.android.article.share.d.e(mBrowserShareHelper.mActivity)
                            .a(ShareAction.wx)
                            .c(mBrowserShareHelper.b)
                            .b(v0)
                            .a(mBrowserShareHelper.c)
                            .a(new ShareImageBean(BitmapFactory.decodeResource(mBrowserShareHelper.mActivity.getResources(), R.drawable.icon))).a();
                    new com.ss.android.g.a.a$a("click_share").a().a();
                }
            });
            view.findViewById(com.ss.android.article.browser.R.id.aad).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mMenuDialog != null) {
                        mMenuDialog.dismiss();
                    }

                    onSettingClick();
                    new com.ss.android.g.a.a$a("click_setting").a().a();
                }
            });
            view.findViewById(com.ss.android.article.browser.R.id.aae).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mMenuDialog != null) {
                        mMenuDialog.dismiss();
                    }
                }
            });
            View v0 = view.findViewById(com.ss.android.article.browser.R.id.aag);
            ((AsyncImageView) v0).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (!Spipe.inst().isLogin) {
                        startActivity(new Intent(ArticleMainActivity.this, AccountLoginActivity.class));
                        if (mMenuDialog != null) {
                            mMenuDialog.dismiss();
                        }
                    }
                }
            });
            View v1 = view.findViewById(com.ss.android.article.browser.R.id.aah);
            if (Spipe.inst().isLogin) {
                ((AsyncImageView) v0).setUrl(Spipe.inst().avatarUrl);
                v1.setVisibility(View.GONE);
            }

            view.findViewById(com.ss.android.article.browser.R.id.aai).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mMenuDialog != null) {
                        mMenuDialog.dismiss();
                    }
                }
            });
        }
    }

    private void initTab() {
        this.mTabContainer = this.findViewById(com.ss.android.article.browser.R.id.browser_tab_container);
        Tab goBackTab = new Tab("go_back", this.findViewById(com.ss.android.article.browser.R.id.layout_button_tab_previous));
        goBackTab.ivIcon.setImageResource(com.ss.android.article.browser.R.drawable.icon_arrow_previous);
        this.tabs[0] = goBackTab;
        goBackTab.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mFeedFragment != null) {
                    mFeedFragment.onGoBackClick();
                }

                new com.ss.android.g.a.a$a("click_back").a().a();
            }
        });
        this.setBackButtonLevel(0);
        View buttonTabNext = this.findViewById(com.ss.android.article.browser.R.id.layout_button_tab_next);
        TagView tagView = null;
        if (buttonTabNext != null) {
            tagView = buttonTabNext.findViewById(com.ss.android.article.browser.R.id.item_button_tab_tag);
        }

        final Tab goNextTab = new Tab("go_next", buttonTabNext, tagView);
        goNextTab.ivIcon.setImageResource(com.ss.android.article.browser.R.drawable.icon_arrow_next);
        goNextTab.ivIcon.setScaleX(-1f);
        this.tabs[1] = goNextTab;
        goNextTab.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!mForwardRefresh) {
                    if (mFeedFragment != null) {
                        mFeedFragment.onGoNextClick();
                    }
                    new com.ss.android.g.a.a$a("click_forward").a().a();
                } else if (mFeedFragment != null) {
                    mFeedFragment.c();
                    redCount = 0;
                    setRedPoint(false, "");
                    goNextTab.ivIcon.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.a5));
                }
            }
        });
        this.setForwardImageLevel(0);
        Tab menuTab = new Tab("menu", this.findViewById(com.ss.android.article.browser.R.id.layout_button_tab_menu));
        menuTab.ivIcon.setImageResource(com.ss.android.article.browser.R.drawable.qs);
        menuTab.itemView.setOnClickListener(new View.OnClickListener() {

            public final void onClick(View view) {
                ArticleMainActivity.this.showSettingDialog();
                new a.a$a("click_more").a().a();
            }
        });
        this.tabs[2] = menuTab;
        menuTab = new Tab("home", this.findViewById(com.ss.android.article.browser.R.id.layout_button_tab_home));
        menuTab.ivIcon.setImageResource(com.ss.android.article.browser.R.drawable.r8);
        menuTab.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mWebsiteGridView != null) {
                    WebSiteGridView v0 = mWebsiteGridView;
                    int v0_1 = v0.mRoot == null || !v0.mRoot.isShown() || v0.mRoot.getParent() == null ? 0 : 1;
                    if (v0_1 != 0) {
                        mWebsiteGridView.a();
                    } else {
                        mWebsiteGridView.b();
                    }
                }

                if (mFeedFragment != null) {
                    mFeedFragment.onMenuTabClick(true);
                }
                setBackButtonLevel(0);
                new com.ss.android.g.a.a$a("click_home").a().a();
            }
        });
        this.tabs[3] = menuTab;
    }

    private void initVideoHolder() {
        if (this.mVideoHolder == null && this.mVideoHolderStub == null) {
            this.mVideoHolderStub = (ViewStub) (this.isUseMainFeedTheme() ? this.findViewById(com.ss.android.article.browser.R.id.yv) : this.findViewById(com.ss.android.article.browser.R.id.z7));
            if (this.mVideoHolderStub != null) {
                this.mVideoHolderStub.inflate();
            }
        }
        this.mVideoHolder = (FrameLayout) this.findViewById(com.ss.android.article.browser.R.id.top_video_holder);
        if (this.mVideoHolder != null) {
            this.updateVideoHolderMargin();
            this.updateViewHolderTopMargin(false);
            this.mVideoController = VideoControllerSupplierProxy.getInstance().getVideoControllerInstance();
            if (this.mVideoController != null) {
                this.mVideoController.reset(this, this.mVideoHolder, true, null);
            }

            this.mVideoFullscreen = new IVideoFullscreen() {

                public final void onFullscreenChanged(boolean arg5) {
                    int v1 = 8;
                    ArticleMainActivity.this.isFullScreen = arg5;
                    if (ArticleMainActivity.this.mStatusBarTintView != null) {
                        View v3 = ArticleMainActivity.this.mStatusBarTintView;
                        int v0 = ArticleMainActivity.this.isFullScreen ? View.GONE : View.VISIBLE;
                        v3.setVisibility(v0);
                    }

                    if (ArticleMainActivity.this.mVideoController != null
                            && ((ArticleMainActivity.this.mVideoController.getContext() instanceof ArticleMainActivity))) {
                        if ((ArticleMainActivity.this.isUseMainFeedTheme())
                                && !ArticleMainActivity.this.isUseMainCategoryTheme()
                                && (arg5)
                                && ArticleMainActivity.this.mVideoHolder != null) {
                            ArticleMainActivity.this.mVideoHolder.setTranslationY(0f);
                        }

                        if (ArticleMainActivity.this.mFeedFragment != null) {
                            ArticleMainActivity.this.mFeedFragment.b(arg5);
                        }

                        View v0_1 = ArticleMainActivity.this.mTabContainer;
                        if (!arg5) {
                            v1 = 0;
                        }

                        UIUtils.setVisibility(v0_1, v1);
                        ArticleMainActivity.this.updateViewHolderTopMargin(arg5);
                    }
                }
            };
            if (this.mVideoController == null) {
                return;
            }

            this.mVideoController.setFullScreenListener(this.mVideoFullscreen);
        }
    }

    public void initVideoView() {
        if (VideoControllerSupplierProxy.getInstance().getVideoControllerInstance() == null || VideoControllerSupplierProxy.getInstance().getVideoControllerInstance().getContext() != this) {
            this.initVideoHolder();
        }
    }

    public boolean isPrimaryPage(IRecentFragment recentFragment) {
        boolean v0 = this.mIMainActivityDelegate != null ? this.mIMainActivityDelegate.isPrimaryPage(recentFragment) : false;
        return v0;
    }

    public boolean isStreamTab() {
        return true;
    }

    private boolean isTranslucentStatusBarEnabled() {
        return true;
    }

    protected boolean isUseMainCategoryTheme() {
        return true;
    }

    protected boolean isUseMainFeedTheme() {
        return true;
    }

    public boolean isViewCategory() {
        return true;
    }

    public boolean isWebsiteUnbind() {
        return this.mWebsiteGridView != null && this.mWebsiteGridView.e;
    }

    public void notifyTabViewChanged(int index) {
    }

    public void notifyTabViewInitialized() {
    }

    public void onAccountRefresh(boolean arg1, int arg2) {
    }

    public void onActivityResult(int requestCode, int resultCode, Intent intent) {
        this.mSkipForceStream = true;
        if (requestCode != 110) {
            if (requestCode == 10) {
                if (intent != null && ("com.ss.android.article.browser.search".equals(intent.getAction()))) {
                    this.mFeedFragment.b(intent.getStringExtra("bundle_query"));
                    return;
                }

                this.onNewIntent(intent);
            }

            super.onActivityResult(requestCode, resultCode, intent);
        }
    }

    private void onAppStartupEvent() {
        long v2;
        long v10;
        long v4;
        Object v0_1;
        JSONObject v8;
        long v6 = 0;
        SparseArrayCompat v9 = com.ss.android.article.base.utils.e.b();
        if (v9 != null && v9.size() > 0) {
            try {
                v8 = new JSONObject();
                v0_1 = v9.get(10000);
                if (v0_1 == null) {
                    return;
                }

                v4 = ((com.ss.android.article.base.utils.e.a) v0_1).c;
                v8.put("total", v4);
                v0_1 = v9.get(10001);
                if (v0_1 != null) {
                    v8.put("application_init", ((com.ss.android.article.base.utils.e.a) v0_1).c);
                }

                v0_1 = v9.get(10002);
                if (v0_1 != null) {
                    v10 = ((com.ss.android.article.base.utils.e.a) v0_1).c;
                    v8.put("splash", ((com.ss.android.article.base.utils.e.a) v0_1).c);
                } else {
                    v10 = v6;
                }
            } catch (Throwable v0) {
                v0.printStackTrace();
                return;
            }

            try {
                v0_1 = v9.get(10003);
                if (v0_1 != null) {
                    v2 = ((com.ss.android.article.base.utils.e.a) v0_1).c;
                    v8.put("splash_ad", ((com.ss.android.article.base.utils.e.a) v0_1).c);
                    if (v10 < v2) {
                        v10 += v2;
                    }
                } else {
                    v2 = v6;
                }

            } catch (Throwable v0) {
                v0.printStackTrace();
                return;
            }

            try {
                label_37:
                v0_1 = v9.get(10004);
                if (v0_1 != null) {
                    v8.put("splash_init", ((com.ss.android.article.base.utils.e.a) v0_1).c);
                }

                v0_1 = v9.get(10005);
                if (v0_1 != null) {
                    v8.put("main_init", ((com.ss.android.article.base.utils.e.a) v0_1).c);
                }

                v0_1 = v9.get(10006);
                if (v0_1 != null) {
                    v8.put("splash_logo", ((com.ss.android.article.base.utils.e.a) v0_1).c);
                } else {
                    if (v2 >= v6 && v10 >= v6) {
                        v8.put("splash_logo", v10 - v2);
                    }
                }

                if (v8.length() <= 0) {
                    return;
                }
                MobClickCombiner.onEvent(this, "launch_stat", "finish", v4, 0, v8);
            } catch (Throwable v0) {
                v0.printStackTrace();
                return;
            }
        }
    }

    public void onBackPressRefresh() {
        if (this.mIMainActivityDelegate != null) {
            this.mIMainActivityDelegate.onBackPressRefresh();
        }
    }

    public void onBackPressed() {
        IVideoController v0 = this.getVideoController();
        if ((v0 == null || !v0.backPress(((Activity) this))) && (this.mFeedFragment == null || !this.mFeedFragment.m()) && (this.mWebsiteGridView == null || !this.mWebsiteGridView.c())) {
            if (android.support.design.a.n()) {
                this.finish();
                return;
            }

            UIUtils.a(((Context) this), "再按一次退出");
        }
    }

    protected void onBookMarkViewClick() {
        Intent v0 = new Intent();
        v0.setClassName(((Context) this), "com.ss.android.article.browser.view.user.UserActionHistoryActivity");
        this.startActivityForResult(v0, 10);
    }

    public void onCreate(Bundle savedInstanceState) {
        this.mAppData = AppData.getInstance();
        super.onCreate(savedInstanceState);
        this.setupStatusBarView((ViewGroup) this.getWindow().getDecorView());
        this.mFeedShowDetector = new FeedShowDetector(this);
        this.mFeedShowDetector.a();
        this.mNetworkMonitor = new NetworkStatusMonitor(this);
        this.init();
        Intent v0 = this.getIntent();
        if (v0 != null) {
            if (v0.getBooleanExtra("from_notification", false)) {
                this.mForceNotShowAdWhenResume = true;
            }
            this.mPromptUploadContacts = v0.getBooleanExtra("prompt_upload_contacts", false);
        }

        LayoutInflater inflater = getLayoutInflater();
        inflater.inflate(R.layout.item_button_tab, null);
        this.setContentView(com.ss.android.article.browser.R.layout.activity_article_main);
        this.mRootView = this.findViewById(com.ss.android.article.browser.R.id.root_view);
        this.initTab();
        this.getWindow().getDecorView().getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
            @Override
            public boolean onPreDraw() {
                getWindow().getDecorView().getViewTreeObserver().removeOnPreDrawListener(this);
                mHandler.sendEmptyMessage(14);
                return true;
            }
        });
        this.mCategoryMgr = CategoryManager.getInstance(((Context) this));
        com.ss.android.l.c.c();
        if (this.mPromptUploadContacts) {
            android.support.design.a.a(this);
        }

        if (!BizApplication.k()) {
            this.onEvent("topic", "init_topic_false");
        }

        this.initBrowser();
        this.onEvent("lite_ui_version", "channel");
        com.ss.android.l.c.c();
    }

    public void onDestroy() {
        super.onDestroy();
        if (this.mMainHelper != null) {
            this.mMainHelper.a();
        }

        InputMethodManagerUtil.fixMemoryLeak(((Activity) this));
        LocationUploadHelper.a(((Context) this)).b();
        if (this.mFeedShowDetector != null) {
            this.mFeedShowDetector.b();
        }

        if (this.mMenuDialog != null) {
            this.mMenuDialog.dismiss();
        }

        if (this.mVideoController != null) {
            this.mVideoController.onActivityDestroy();
        }

        if (this.mNetworkMonitor != null) {
            this.mNetworkMonitor.onDestroy();
        }

        if (TabInspector.getInstance() != null) {
            TabInspector.getInstance().d();
            TabInspector.sInstance = null;
        }
    }

    protected void onDownloadClick() {
        Intent intent = new Intent();
        intent.setClassName(this, "com.ss.android.article.browser.view.user.UserActionHistoryActivity");
        intent.putExtra("show_content", 1);
        this.startActivityForResult(intent, 10);
    }

    void onEvent(String arg1, String arg2) {
        MobClickCombiner.onEvent(((Context) this), arg1, arg2);
    }

    void onEvent(String arg10, String arg11, int arg12) {
        long v4 = 0;
        if (arg12 >= 0 && arg12 <= this.mList.size() - 1) {
            CategoryItem categoryItem = this.mList.get(arg12);
            if (categoryItem == null) {
                MobClickCombiner.onEvent(this, arg10, arg11);
            } else {
                JSONObject jsonObject = new JSONObject();
                try {
                    jsonObject.put("category_id", categoryItem.categoryId);
                    jsonObject.put("concern_id", categoryItem.concernId);
                    jsonObject.put("refer", 1);
                } catch (JSONException jsonException) {
                    jsonException.printStackTrace();
                }
                MobClickCombiner.onEvent(this, arg10, arg11, v4, v4, jsonObject);
            }
        } else {
            MobClickCombiner.onEvent(this, arg10, arg11);
        }
    }

    public void onFeedShow(boolean arg1) {
        this.delayInit();
    }

    protected void onFirstFrameDraw() {
        if (!this.mFirstFrameDrawn) {
            this.mFirstFrameDrawn = true;
            this.onAppStartupEvent();
        }
    }

    protected void onHistoryPageClick() {
        Intent intent = new Intent();
        intent.putExtra("default_select_page", 1);
        intent.setClassName(this, "com.ss.android.article.browser.view.user.UserActionHistoryActivity");
        this.startActivityForResult(intent, 10);
    }

    public void onLastReadShow() {
        if (this.mIMainActivityDelegate != null) {
            this.mIMainActivityDelegate.onLastReadShow();
        }
    }

    public void onLayoutChanged(int arg1) {
    }

    public void onListViewScrollStateChanged(int arg2) {
        if (this.mIMainActivityDelegate != null) {
            this.mIMainActivityDelegate.onListViewScrollStateChanged(arg2);
        }
    }

    public void onLoadingStatusChanged(IRecentFragment arg3) {
        if (this.mIMainActivityDelegate != null) {
            this.mIMainActivityDelegate.onLoadingStatusChanged(arg3);
        }

        if (!arg3.isLoading()) {
            this.redCount = 0;
            UIUtils.c(this.tabs[1].ivIcon);
        }
    }

    public void onNewIntent(final Intent intent) {
        if (intent != null) {
            if (this.mFeedFragment != null) {
                this.mFeedFragment.onNewIntent(intent.getExtras());
            }

            if (intent.getBooleanExtra("from_notification", false)) {
                this.mForceNotShowAdWhenResume = true;
            }

            if (this.mPresenter == null) {
                return;
            }

            this.mPresenter.mTabInspector.a(new Runnable() {

                public final void run() {
                    FeedFragment feedFragment;
                    String v0 = intent != null ? intent.getDataString() : null;
                    int v3 = intent == null || intent.getExtras() == null ? 0 : intent.getExtras().getInt("URL_INTENT_ORIGIN");
                    if (v3 != 0) {
                        feedFragment = mPresenter.mTabInspector.a(v3);
                        if (feedFragment != null) {
                            feedFragment.loadUrl(v0);
                        }
                    } else if (!TextUtils.isEmpty(((CharSequence) v0))) {
                        if (URLUtil.isFileUrl(v0)) {
                            mPresenter.mBrowserPage.showBlockedLocalFileDialog(new DialogInterface.OnClickListener() {

                                public final void onClick(DialogInterface arg1, int arg2) {
                                }
                            });
                        } else {
                            if ((TextUtils.equals(((CharSequence) v0), "http://lemon_browser_setting")) && mPresenter.mBrowserPage != null) {
                                BrowserPage v0_1 = mPresenter.mBrowserPage;
                                ArrayList v3_1 = android.support.design.a.getPreferredBrowser(((Context) v0_1));
                                int v0_2 = (((List) v3_1).isEmpty()) || !android.support.design.a.a(v3_1, ((Context) v0_1)) ? 0 : 1;
                                if (v0_2 != 0) {
                                    Toast.makeText((ArticleMainActivity) mPresenter.mBrowserPage, "设置默认浏览器成功", Toast.LENGTH_SHORT).show();
                                    return;
                                }

                                Toast.makeText((ArticleMainActivity) mPresenter.mBrowserPage, "设置失败！请按图示操作~", Toast.LENGTH_SHORT).show();
                                return;
                            }

                            feedFragment = mPresenter.mTabInspector.getCurrentFragment();
                            if (feedFragment == null) {
                                return;
                            }
                            feedFragment.loadUrl(v0);
                        }
                    }
                }
            });
        }
    }

    public void onPageChangedEnd(boolean index) {
        ArticleMainActivity v3;
        int v0;
        int v1 = 1;
        if (this.mFeedFragment.p()) {
            v0 = 2;
            v3 = this;
        } else if (this.mFeedFragment.k()) {
            v0 = 1;
            v3 = this;
        } else {
            v0 = 0;
            v3 = this;
        }

        v3.setForwardImageLevel(v0);
        if (!(this.mFeedFragment instanceof HomePageFragment) || (this.mFeedFragment.o())) {
            if (!this.mFeedFragment.j()) {
                v1 = 0;
            }

            this.setBackButtonLevel(v1);
        } else {
            this.setBackButtonLevel(0);
        }
    }

    public void onPageChangedStart(boolean arg5) {
        if (arg5) {
            this.setForwardRefreshFeed(false);
        }

        if (this.mFeedFragment != null) {
            if (this.mFeedFragment.k()) {
                this.setForwardImageLevel(1);
            } else {
                this.setForwardImageLevel(0);
            }

            if ((this.mFeedFragment instanceof HomePageFragment)) {
                FeedFragment v0 = this.mFeedFragment;
                if (!((HomePageFragment) v0).o() && (((HomePageFragment) v0).x())) {
                    this.setForwardImageLevel(2);
                    this.mForwardRefresh = true;
                    this.setBackButtonLevel(0);
                    return;
                }
            }

            int v0_1 = this.mFeedFragment.j() ? 1 : 0;
            this.setBackButtonLevel(v0_1);
        }
    }

    public void onPause() {
        super.onPause();
        if (this.mFeedShowDetector.c()) {
            this.afterFeedShowOnPaused();
        }

        if (VideoControllerSupplierProxy.getInstance().getVideoControllerInstance() != null) {
            VideoControllerSupplierProxy.getInstance().getVideoControllerInstance().releaseWhenOnPause();
        }

        if (this.mNetworkMonitor != null) {
            this.mNetworkMonitor.onPause();
        }
    }

    public void onResume() {
        super.onResume();
        if (!NetworkUtils.isNetworkAvailable(((Context) this))) {
            android.support.design.a.a(((Context) this), "请检查网络连接", null, 0);
        }

        if (this.mIsFirstResume) {
            this.mIsFirstResume = false;
        }

        SplashAdActivity.a(((Context) this), this.mForceNotShowAdWhenResume);
        this.mForceNotShowAdWhenResume = false;
        if (this.mFeedShowDetector.c()) {
            this.afterFeedShowOnResumed();
        }

        if (this.mNetworkMonitor != null) {
            this.mNetworkMonitor.registerNetworkStateReceiver();
        }
    }

    public void onSearchTextRefresh(SearchTextData arg3) {
        if ((this.isViewValid()) && this.mMainSearchHintTextView != null && arg3 != null) {
            int v0 = (TextUtils.isEmpty(arg3.homePageSearchSuggest)) || (TextUtils.isEmpty(arg3.b)) || (TextUtils.isEmpty(arg3.c)) ? 0 : 1;
            if (v0 == 0) {
                return;
            }

            if (!arg3.c.equals(this.getCategory())) {
                return;
            }

            this.mMainSearchHintTextView.setText(arg3.homePageSearchSuggest);
            this.mHomeSearchSuggestText = arg3.homePageSearchSuggest;
        }
    }

    protected void onSettingClick() {
        Intent v0 = new Intent();
        v0.setClassName(((Context) this), "com.ss.android.article.browser.setting.SettingActivity");
        this.startActivity(v0);
    }

    public void onStart() {
        super.onStart();
        WebViewTweaker.tryDisableAccessibility();
    }

    public void onStop() {
        super.onStop();
        if (this.mLargeImageLoader != null) {
            this.mLargeImageLoader.a.pause();
        }
    }

    public void onUserPullToRefresh() {
        if (this.mIMainActivityDelegate != null) {
            this.mIMainActivityDelegate.onUserPullToRefresh();
        }

        this.setRedPoint(false, "");
    }

    public void onWaitFeedTimeout() {
        this.delayInit();
    }

    public void onWindowFocusChanged(boolean arg1) {
        super.onWindowFocusChanged(arg1);
        this.isWindowFocus = arg1;
    }

    @Subscriber
    private boolean pullDownRefreshStreamTab() {
        return this.mIMainActivityDelegate != null && this.mIMainActivityDelegate.q_();
    }

    public void removeDelayInitCallback(DelayInitCallback delayInitCallback) {
        if (this.mDelayInitCallbacks != null) {
            this.mDelayInitCallbacks.remove(delayInitCallback);
        }
    }

    public void removeTabView() {
        ArticleMainActivity.removeViewFromParent(this.mCurrentView);
        this.mCurrentView = null;
    }

    public void setBackButtonEnabled(boolean backButtonEnabled) {
    }

    protected void setBackButtonLevel(int arg4) {
        int v0_1;
        View v2 = this.tabs[0].itemView;
        boolean v0 = arg4 != 0 ? true : false;
        v2.setClickable(v0);
        switch (arg4) {
            case 1: {
                v0_1 = R.drawable.icon_arrow_previous_enabled;
                break;
            }
            default: {
                v0_1 = R.drawable.icon_arrow_previous_disabled;
                break;
            }
        }

        this.tabs[0].ivIcon.setImageResource(v0_1);
    }

    public void setBottomTabVisible(int bottomTabVisible) {
        this.mTabContainer.setVisibility(bottomTabVisible);
    }

    public void setForwardButtonEnabled(boolean forwardButtonEnabled) {
    }

    private void setForwardImageLevel(int arg4) {
        int v0_1;
        View v2 = this.tabs[1].itemView;
        boolean v0 = arg4 != 0 ? true : false;
        v2.setClickable(v0);
        switch (arg4) {
            case 1: {
                v0_1 = R.drawable.icon_arrow_previous_enabled;
                this.hideRedPoint();
                break;
            }
            case 2: {
                v0_1 = R.drawable.icon_tab_button_refresh;
                break;
            }
            default: {
                v0_1 = R.drawable.icon_arrow_previous_disabled;
                this.hideRedPoint();
                break;
            }
        }

        this.tabs[1].ivIcon.setImageResource(v0_1);
    }

    public void setForwardRefreshFeed(boolean forwardRefreshFeed) {
        int v0;
        if (this.mForwardRefresh != forwardRefreshFeed) {
            this.mForwardRefresh = forwardRefreshFeed;
            if (forwardRefreshFeed) {
                v0 = 2;
            } else if (this.mFeedFragment.k()) {
                v0 = 1;
            } else {
                v0 = 0;
            }

            this.setForwardImageLevel(v0);
        }
    }

    public void setRedCount(int arg1) {
        this.redCount = arg1;
    }

    public void setRedPoint(boolean arg6, String arg7) {
        int v0_1;
        View v0 = this.findViewById(com.ss.android.article.browser.R.id.website_navi_grid);
        if (v0 != null) {
            if (v0.getAlpha() >= 1f) {
                if ((TextUtils.isEmpty(((CharSequence) arg7))) || !TextUtils.isDigitsOnly(((CharSequence) arg7))) {
                    this.redCount = 0;
                } else {
                    v0_1 = Integer.parseInt(arg7);
                    if (v0_1 <= 0) {
                        v0_1 = 0;
                    }

                    this.redCount = v0_1;
                }

                this.tabs[1].tagView.setVisibility(View.GONE);
            } else if (arg6) {
                this.tabs[1].tagView.setCustomBgColor(this.getTabBarColor());
                this.tabs[1].tagView.setTagType(3);
                if (!TextUtils.isEmpty(((CharSequence) arg7)) && (TextUtils.isDigitsOnly(((CharSequence) arg7)))) {
                    v0_1 = Integer.parseInt(arg7);
                    if (v0_1 > 0) {
                        this.redCount = v0_1;
                        this.tabs[1].tagView.setNumber(v0_1);
                        this.tabs[1].tagView.setVisibility(View.VISIBLE);
                    } else {
                        this.tabs[1].tagView.setVisibility(View.GONE);
                    }

                    return;
                }

                this.tabs[1].tagView.setVisibility(View.GONE);
            } else {
                this.tabs[1].tagView.setVisibility(View.GONE);
            }
        }
    }

    public void setTabView(FeedFragment feedFragment) {
        if (!this.isDestroyed() && !this.isFinishing()) {
            if (feedFragment != null && ((feedFragment instanceof com.ss.android.article.browser.website.a)) && AppData.getInstance() != null) {
                AppData appData = AppData.getInstance();
                if (NetworkUtils.isNetworkAvailable(this)) {
                    Context context = appData.mContext;
                    WeakHandler weakHandler = appData.mWeakHandler;
                    boolean v0_1 = !appData.mDefaultSettingLoaded;
                    new com.ss.android.newmedia.j.c(context, weakHandler, v0_1).start();
                }
            }

            if (this.mFragmentManager == null) {
                this.mFragmentManager = new FragmentManagerWrapper(this.getSupportFragmentManager());
            }
            this.mFragmentManager.beginTransaction().replace(com.ss.android.article.browser.R.id.main_content_container, (Fragment) feedFragment).commitAllowingStateLoss();
            feedFragment.setOnPageScrolledListener(new OnPageScrolledListener() {

                @Override
                public final void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
                    super.onPageScrolled(position, positionOffset, positionOffsetPixels);
                    IVideoController videoController = ArticleMainActivity.this.getVideoController();
                    if (videoController != null) {
                        videoController.syncPosition(false);
                    }
                }
            });
            this.mFeedFragment = feedFragment;
            this.mIMainActivityDelegate = this.mFeedFragment;
        }
    }

    @SuppressLint("ResourceType")
    @Override
    public void setTheme(int themeId) {
        if (!com.ss.android.j.c.isAboveLOLLIPOP()) {
            super.setTheme(themeId);
        } else if (themeId >= 0) {
            if (this.mOriginTheme == -1) {
                this.mOriginTheme = themeId;
            }
            int newThemeId = ClickableBackgroundCompat.getTheme(themeId);
            if (newThemeId == this.mCurTheme) {
                return;
            }
            this.mCurTheme = newThemeId;
            super.setTheme(this.mCurTheme);
        }
    }

    public void setToolbar(Toolbar toolbar) {
        this.setSupportActionBar(toolbar);
    }

    private void setVideoLayoutMargin(int topMargin) {
        if (this.mVideoHolder != null) {
            ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) this.mVideoHolder.getLayoutParams();
            if (layoutParams != null && ((layoutParams instanceof ViewGroup.MarginLayoutParams))) {
                layoutParams.topMargin = topMargin;
                this.mVideoHolder.setLayoutParams(layoutParams);
            }
        }
    }

    public void setWebsiteLayout(List arg2) {
        ((HomePageFragment) mFeedFragment).bindWebsiteNavigationGrid(arg2);
    }

    private void setupStatusBarView(ViewGroup arg3) {
        if ((this.isTranslucentStatusBarEnabled()) && arg3 != null && !(arg3 instanceof LinearLayout) && !this.isFinishing() && Build.VERSION.SDK_INT >= 19) {
            this.getWindow().addFlags(67108864);
        }
    }

    public void showBlockedLocalFileDialog(@NonNull DialogInterface.OnClickListener onClickListener) {
        android.support.design.a.resizeDialog(this, new android.support.v7.app.AlertDialog.Builder(this)
                .setCancelable(true)
                .setTitle(com.ss.android.article.browser.R.string.warning)
                .setMessage(com.ss.android.article.browser.R.string.local_file_blocked)
                .setNegativeButton(17039360, null)
                .setPositiveButton(com.ss.android.article.browser.R.string.open, onClickListener)
                .show());
    }

    public void showRedPoint() {
        if (this.redCount > 0) {
            this.setRedPoint(true, this.redCount + "");
        }
    }

    public void showSettingDialog() {
        this.mMenuDialog = new Dialog(this, R.style.MenuDialogStyle);
        View view = android.support.design.a.createInterceptLayoutInflater(this).inflate(com.ss.android.article.browser.R.layout.dialog_setting, null);
        android.support.design.a.b(view, R.layout.dialog_setting);
        this.initDialogClick(view);
        this.mMenuDialog.setContentView(view);
        WindowManager.LayoutParams layoutParams = this.mMenuDialog.getWindow().getAttributes();
        layoutParams.width = ((WindowManager) this.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth();
        this.mMenuDialog.getWindow().setAttributes(layoutParams);
        this.mMenuDialog.getWindow().setWindowAnimations(R.style.MenuDialogAnimation);
        this.mMenuDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
        this.mMenuDialog.show();
    }

    public boolean showTipsFor(String tips) {
        if (this.mIMainActivityDelegate != null) {
            this.mIMainActivityDelegate.showTipsFor(tips);
        }
        return false;
    }

    public void showWebsiteNavigation() {
        this.mWebsiteGridView = new WebSiteGridView(this.getActivity());
        this.mWebsiteGridView.b.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mWebsiteGridView.setVisible(false);
                ((HomePageFragment) mFeedFragment).a.a(true);
            }
        });
        this.mWebsiteGridView.c.b = new com.ss.android.article.browser.view.a.b.a() {

            @Override
            public void a(int index) {
                mFeedFragment.loadUrl(mWebsiteGridView.c.a.get(index).open_url);
                mWebsiteGridView.setVisible(false);
            }
        };
        List v0_1 = this.mPresenter.mNavigationBeanList.size() > 20 ? this.mPresenter.mNavigationBeanList.subList(5, this.mPresenter.mNavigationBeanList.size()) : null;
        mWebsiteGridView.c.a(v0_1);
        ((ViewGroup) this.findViewById(com.ss.android.article.browser.R.id.main_content_container)).addView(this.mWebsiteGridView.mRoot);
        ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(this.mWebsiteGridView.mRoot, "translationX", new float[]{((float) this.mWebsiteGridView.d), 0f});
        objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
        objectAnimator
                .setDuration(200)
                .start();
    }

    public void switchCategory(CategoryItem categoryItem, int arg3) {
        if (this.mIMainActivityDelegate != null) {
            this.mIMainActivityDelegate.switchCategory(categoryItem, arg3);
        }
    }

    public void tabNumberChanged(int tabNumber) {
    }

    void tryShowUploadContactsGuide() {
        if ((this.isActive()) && (this.isViewValid())) {
            SubscriptionRouter.addSubscriber(this);
            long uploadContactControl = this.mAppData.getAppSettings().getUploadContactControl();
            this.mAppData.mUploadContactVersion = uploadContactControl;
            SharedPreferences.Editor editor = this.mAppData.mContext.getSharedPreferences("app_setting", 0).edit();
            editor.putLong("upload_contact_version", uploadContactControl);
            SharedPreferenceCompat.commit(editor);
        }
    }

    public void updataVideoView(boolean arg3) {
        int v0 = this.getResources().getDimensionPixelSize(R.dimen.hy);
        if (arg3) {
            this.setVideoLayoutMargin(v0);
        } else {
            this.setVideoLayoutMargin(0);
        }
    }

    public void updateCategoryTip(String arg3) {
        if (this.mIMainActivityDelegate != null) {
            this.mIMainActivityDelegate.updateCategoryTip(arg3);
        }

        if (NetworkUtils.isNetworkAvailable(((Context) this))) {
            this.setRedPoint(true, arg3);
        } else {
            this.setRedPoint(false, "");
        }
    }

    public void updateProgress(int progress) {
    }

    public void updateTabNumber(int number) {
    }

    private void updateTranslucentStatusBarColor(@ColorInt int arg3) {
        if ((this.isTranslucentStatusBarEnabled()) && this.mStatusBarTintView != null) {
            this.mStatusBarTintView.setBackgroundDrawable(null);
        }
    }

    public void updateUrl(String url, boolean arg2) {
    }

    private void updateVideoHolderMargin() {
        if ((this.isUseMainFeedTheme()) && this.mVideoHolder != null && this.mRootView != null) {
            final View v0 = this.mRootView;
            if (v0.getWidth() != 0 && v0.getHeight() != 0) {
                this.updateVideoMargin(v0);
                return;
            }

            v0.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() {
                    if (Build.VERSION.SDK_INT >= 16) {
                        v0.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                    } else {
                        v0.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                    }

                    updateVideoMargin(v0);
                }
            });
        }
    }

    void updateVideoMargin(View arg4) {
        if (arg4 != null && this.mVideoHolder != null && this.mRootView != null && !this.isFinishing()) {
            int[] v0 = new int[2];
            this.mRootView.getLocationOnScreen(v0);
            int v1 = v0[1];
            arg4.getLocationOnScreen(v0);
            int v0_1 = v0[1] - v1;
            v1 = !this.isTranslucentStatusBarEnabled() || Build.VERSION.SDK_INT < 19 || !this.mRootView.getFitsSystemWindows() ? v0_1 : v0_1 - this.mRootView.getPaddingTop();
            ViewGroup.LayoutParams v0_2 = this.mVideoHolder.getLayoutParams();
            if (v0_2 == null) {
                return;
            }

            if (!(v0_2 instanceof ViewGroup.MarginLayoutParams)) {
                return;
            }

            if (((ViewGroup.MarginLayoutParams) v0_2).topMargin == v1) {
                return;
            }

            ((ViewGroup.MarginLayoutParams) v0_2).topMargin = v1;
            this.mVideoHolder.setLayoutParams(v0_2);
        }
    }

    protected void updateViewHolderTopMargin(boolean arg5) {
        int v1 = 0;
        ViewGroup.LayoutParams v0 = this.mVideoHolder.getLayoutParams();
        if (!arg5) {
            if (ImmersedStatusBarHelper.isEnabled()) {
                v1 = ImmersedStatusBarHelper.getStatusBarHeight(this, true);
            }

            ((ViewGroup.MarginLayoutParams) v0).topMargin = v1 + this.getResources().getDimensionPixelOffset(R.dimen.c6) + this.getResources().getDimensionPixelOffset(R.dimen.gq);
        } else {
            ((ViewGroup.MarginLayoutParams) v0).topMargin = 0;
        }

        this.mVideoHolder.setLayoutParams(v0);
    }
}

